import java.io.File;
import java.io.IOException;
public class project13 {
    public static void main(String[] args) {
        String path="E:\\湖北师范大学\\test.txt";
        File file=new File(path);
        if(file.exists()) {
            boolean result = file.delete();
            if (result) {
                System.out.println("文件删除成功");
            } else {
                System.out.println("文件删除失败");
            }
        }else{
            try{
                boolean result=file.createNewFile();
                if(result){
                    System.out.println("文件创建成功");
                }else{
                    System.out.println("文件创建失败");
                }
            }catch(IOException e){
                System.out.println("文件创建失败");
            }
        }
    }
}
